﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows.Data;

#if !SILVERLIGHT
using UIT.WPF.Converters;

namespace UIT.WPF.Renderers
#else
using UIT.Silverlight.Converters;

namespace UIT.Silverlight.Renderers
#endif
{
#if !SILVERLIGHT
    class TextBlockRenderer : 
        WpfRenderer<Controls.TextBlock, TextBlock>
#else
    public class TextBlockRenderer :
        SlRenderer<Controls.TextBlock, TextBlock>
#endif		
        
    {
        public override void Render(Controls.TextBlock control)
        {
            Result = new TextBlock();
            Result.DataContext = control;
            Result.SetBinding(TextBlock.TextProperty, new Binding("Text"));
            Result.SetBinding(TextBlock.ForegroundProperty, new Binding("Style.Text.Color") { Converter = new ColorConverter() });
            Result.SetBinding(TextBlock.TextWrappingProperty, new Binding("Style.Text.Wrap") { Converter = new WrappingConverter() });
            Result.SetBinding(TextBlock.FontSizeProperty, new Binding("Style.Text.Size.Value"));
        }
    }
}
